<html>
<head><meta charset="utf-8"><title>s390x max_by_val_size · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html">s390x max_by_val_size</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="230377306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230377306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230377306">(Mar 15 2021 at 16:27)</a>:</h4>
<p>(I still want to add a target spec for that -- s390x re-spills such &gt;usize args back to memory, which also triggered an LLVM bug)</p>



<a name="230377439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230377439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230377439">(Mar 15 2021 at 16:28)</a>:</h4>
<p>The abi adjustment code for s390x should be adapted for this then.</p>



<a name="230377482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230377482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230377482">(Mar 15 2021 at 16:29)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/7a7bbdb3abfa72ca717ef54ffc4f307d0d44de67/compiler/rustc_target/src/abi/call/s390x.rs">https://github.com/rust-lang/rust/blob/7a7bbdb3abfa72ca717ef54ffc4f307d0d44de67/compiler/rustc_target/src/abi/call/s390x.rs</a></p>



<a name="230377697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230377697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230377697">(Mar 15 2021 at 16:30)</a>:</h4>
<p>What is the exact problem <span class="user-mention" data-user-id="138448">@cuviper</span>?</p>



<a name="230377763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230377763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230377763">(Mar 15 2021 at 16:30)</a>:</h4>
<p>that was <a href="https://github.com/rust-lang/rust/issues/80810">#80810</a></p>



<a name="230377845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230377845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230377845">(Mar 15 2021 at 16:31)</a>:</h4>
<p>fixed in LLVM now, but I'd like to avoid the useless spill back to memory</p>



<a name="230378149"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230378149" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230378149">(Mar 15 2021 at 16:33)</a>:</h4>
<p>Rustc already seems to force any type &gt;8 bytes to be passed indirectly on s390x: <a href="https://github.com/rust-lang/rust/blob/7a7bbdb3abfa72ca717ef54ffc4f307d0d44de67/compiler/rustc_target/src/abi/call/s390x.rs#L59">https://github.com/rust-lang/rust/blob/7a7bbdb3abfa72ca717ef54ffc4f307d0d44de67/compiler/rustc_target/src/abi/call/s390x.rs#L59</a> Thus undoing the promotion to registers as it didn't happen.</p>



<a name="230378283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230378283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230378283">(Mar 15 2021 at 16:34)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> does that source file apply to "Rust" abi too? because the problem I saw had <code>i96</code> args in LLVM IR</p>



<a name="230378351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230378351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230378351">(Mar 15 2021 at 16:34)</a>:</h4>
<p>It runs after the adjustments for the "Rust" abi.</p>



<a name="230378404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230378404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230378404">(Mar 15 2021 at 16:35)</a>:</h4>
<p>then I need to untangle why that apparently didn't happen</p>



<a name="230378589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230378589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230378589">(Mar 15 2021 at 16:36)</a>:</h4>
<p>Is it possible that an LLVM pass promoted it to be passed directly? Does the same thing happen with <code>-Cno-prepopulate-passes</code>?</p>



<a name="230378846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230378846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230378846">(Mar 15 2021 at 16:38)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">(</span><span class="n">_</span>: <span class="p">[</span><span class="kt">u32</span><span class="p">;</span><span class="w"> </span><span class="mi">3</span><span class="p">])</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
</code></pre></div>
<div class="codehilite"><pre><span></span><code>rustc +nightly --crate-type lib --emit=llvm-ir -Cno-prepopulate-passes foo.rs --target s390x-unknown-linux-gnu

 define void @_ZN3foo3foo17he5ff0c6f00da1358E(i96 %0) unnamed_addr #0 {
</code></pre></div>



<a name="230380005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230380005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230380005">(Mar 15 2021 at 16:46)</a>:</h4>
<p>Oh, it seems that <code>adjust_for_cabi</code> doesn't get called after all for the <code>"Rust"</code> abi: <a href="https://github.com/rust-lang/rust/blob/17a07d71bfd692f9b2dad2a566aff52bf3d4bfe2/compiler/rustc_middle/src/ty/layout.rs#L2922">https://github.com/rust-lang/rust/blob/17a07d71bfd692f9b2dad2a566aff52bf3d4bfe2/compiler/rustc_middle/src/ty/layout.rs#L2922</a></p>



<a name="230380007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230380007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230380007">(Mar 15 2021 at 16:46)</a>:</h4>
<p>it looks like this goes <code>adjust_for_cabi</code> -&gt; <code>s390x::compute_abi_info</code> -&gt; <code>classify_arg</code></p>



<a name="230380012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230380012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230380012">(Mar 15 2021 at 16:46)</a>:</h4>
<p>right</p>



<a name="230380260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230380260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230380260">(Mar 15 2021 at 16:48)</a>:</h4>
<p>so my thought was that <code>max_by_val_size</code> should be in the target spec for Rust abi</p>



<a name="230380422"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230380422" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230380422">(Mar 15 2021 at 16:49)</a>:</h4>
<p>we should probably split this tangent to a new thread, but I don't know how...</p>



<a name="230380566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230380566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230380566">(Mar 15 2021 at 16:50)</a>:</h4>
<p>I asked before here: <a href="#narrow/stream/182449-t-compiler.2Fhelp/topic/Arch-specific.20ABI.20changes/near/227648202">https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Arch-specific.20ABI.20changes/near/227648202</a></p>



<a name="230380712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230380712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230380712">(Mar 15 2021 at 16:50)</a>:</h4>
<p>Changed the topic. (If you click on edit for the first message that needs to be changed, you can change the topic too)</p>



<a name="230381119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230381119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230381119">(Mar 15 2021 at 16:53)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> do you think the target spec is the right place? or should it be hard-coded somewhere like we do for cabi?</p>



<a name="230381441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230381441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230381441">(Mar 15 2021 at 16:55)</a>:</h4>
<p>The target spec is the right place I guess.</p>



<a name="230383205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/s390x%20max_by_val_size/near/230383205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> cuviper <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/s390x.20max_by_val_size.html#230383205">(Mar 15 2021 at 17:05)</a>:</h4>
<p>I'll give it a shot</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>